package cn.edu.sdu.sol.material_management_system.controller;

import cn.edu.sdu.sol.material_management_system.model.vo.DataRequest;
import cn.edu.sdu.sol.material_management_system.model.vo.DataResponse;
import cn.edu.sdu.sol.material_management_system.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(origins = "*", maxAge = 3600)
@RestController
@RequestMapping("/api/room")
public class RoomController {

    @Autowired
    RoomService roomService;

    @PostMapping("/get-room-num")
    public DataResponse getRoomNum(@RequestHeader("Authorization") String token) {
        return roomService.getRoomNum(token);
    }

    @PostMapping("/add-room")
    public DataResponse addRoom(@RequestBody DataRequest dataRequest, @RequestHeader("Authorization") String token) {
        return roomService.addRoom(dataRequest, token);
    }
}
